home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / tools / czesc_3 / phoonsrc / libi / alocaltime.c < prev    next >
C/C++ Source or Header  |  1994-02-23  |  885b  |  50 lines

  1. /*
  2.  * alocaltime.c
  3.  *
  4.  * Author: Tomi Ollila <too@cs.hut.fi>
  5.  *
  6.  *     Copyright (c) 1994 Tomi Ollila
  7.  *         All rights reserved
  8.  *
  9.  * Created: Wed Feb 23 16:29:03 1994 too
  10.  * Last modified: Thu Feb 24 10:43:47 1994 too
  11.  *
  12.  * HISTORY
  13.  * $Log: $
  14.  */
  15.  
  16. #include <exec/types.h>
  17. #include <utility/date.h>
  18.  
  19. static struct UtilityBase * UtilityBase;
  20.  
  21. #include <inline/exec.h>
  22. #include <inline/utility.h>
  23.  
  24. #include <time.h>
  25.  
  26. struct tm tm = { 0 };
  27.  
  28. struct tm * alocaltime(ULONG * time)
  29. {
  30.   struct ClockData cd;
  31.  
  32.   if ((UtilityBase = (struct UtilityBase *)OpenLibrary("utility.library", 37)
  33.        ) == NULL)
  34.     return NULL;
  35.   
  36.   Amiga2Date(*time, &cd);
  37.  
  38.   tm.tm_sec = cd.sec;
  39.   tm.tm_min = cd.min;
  40.   tm.tm_hour = cd.hour;
  41.   tm.tm_mday = cd.mday;
  42.   tm.tm_mon = cd.month - 1;
  43.   tm.tm_year = cd.year - 1900;
  44.   tm.tm_wday = cd.wday;
  45.  
  46.   CloseLibrary((struct Library *)UtilityBase);
  47.   
  48.   return &tm;
  49. }
  50.